<?php

namespace Phones\MainBundle\Controller;

class BrandController extends AppController {

    public function indexAction($brand) {
        $theBrand  = $this->getEntity('Brand')
                          ->findByName($brand)[0];
        $models = $this->getEntity('Model')
                       ->findByBrand($theBrand);

        return $this->render(null, compact('models', 'theBrand'));
    }

    public function modelAction($brand, $modelId, $modelName) {
        $model  = $this->getEntity('Model')
                       ->findById($modelId)[0];
        $model->setContainer($this->container);
        return $this->render(null, compact('model'));
    }

}